package com.lyf.Array;

import java.util.Scanner;

public class Scores {
    public static void main(String[] args) {
        bianli();

    }
    //遍历
    public static void bianli(){
        double[] Scores=new double[8];
        Scanner sc=new Scanner(System.in);
        for(int i=0;i<8;i++) {
            System.out.println("请输入第" + (i + 1) + "位同学的成绩：");
            Scores[i] = sc.nextDouble();
        }
        double ascore= Scores[0];
        double maxscore=Scores[0];
        double minscore=Scores[0];
        for(int i=1;i<8;i++){
            ascore+=Scores[i];
            if(Scores[i]>maxscore){
                maxscore=Scores[i];
            }
            if (Scores[i]<minscore){
                minscore=Scores[i];
            }

        }
        System.out.println("平均成绩是："+ascore/8);
        System.out.println("最高成绩是："+maxscore);
        System.out.println("最低成绩是："+minscore);
    }
}
